﻿/*
   Open Intel 
   Copyright © 2011 – ISC. All Rights Reserved.
*/

using Caliburn.Micro;

namespace OIManager.ViewModels
{
    public class MessageBoxViewModel : Screen
    {
        public string Message { get; set; }

        public bool ShowCancel
        {
            get { return _ShowCancel; }
            private set 
            { 
                _ShowCancel = value;
                NotifyOfPropertyChange(() => ShowCancel);
            }
        }
        private bool _ShowCancel;


        public System.Action OkAction { get; private set; }


        public MessageBoxViewModel()
        {
            ShowCancel = false;
        }


        public MessageBoxViewModel(bool showCancel, System.Action okAction)
        {
            ShowCancel = showCancel;
            OkAction = okAction;
        }


        public void Ok()
        {
            TryClose();

            if (OkAction != null)
            {
                OkAction();
            }
        }


        public void Cancel()
        {
            TryClose();
        }
    }
}